#ifndef FMAIN_H
#define FMAIN_H

#include <QWidget>
#include "CGrabWidget.h"
#include "fTextEdit.h"
namespace Ui {
class fMain;
}

class fMain : public QWidget
{
    Q_OBJECT

public:
    explicit fMain(QWidget *parent = 0);
    ~fMain();
signals:
    void sShowContent();
    void sGrabFinished();
protected slots:
    void onOCR();
    void onGrabRect(const QRect&rect);
    void onShowContent();
    void onClose();
    void onGetGrabImage();
protected:
    QImage toGray(const QPixmap&pm);
    QString callTesseract(const QImage&img);
    bool event(QEvent *e);
    void mouseMoveEvent(QMouseEvent *e);
    void mousePressEvent(QMouseEvent *e);
    void mouseReleaseEvent(QMouseEvent *e);
    void showEvent(QShowEvent *e);
    void hideEvent(QHideEvent *e);
    void moveEvent(QMoveEvent *e);
private:
    CGrabWidget*gw;
    fTextEdit*edit;
    Ui::fMain *ui;
    QPoint pLast,pDown;
};

#endif // FMAIN_H
